package com.utils.httpclient;

import java.util.Map;

/**
 * HTTPCLIENT 辅助类
 * 
 * @author JIANGLONG
 *
 */
public class HttpClientAssisstant {

	/**
	 * GET请求
	 * 
	 * @param url
	 * @param params
	 * @param encode
	 * @return
	 */
	public static String doGet(String url, Map<String, String> params, String encode) throws Exception {
		HttpClientBean clientBean = new HttpClientBean(url, params, encode, null);
		String result = clientBean.doGet();
		return result;
	}

	/**
	 * POST请求
	 * 
	 * @param url
	 * @param params
	 * @param encode
	 * @param contentType
	 * @return
	 */
	public static String doPost(String url, Map<String, String> params, String encode, ContentTypeEnum contentType)
			throws Exception {
		HttpClientBean clientBean = new HttpClientBean(url, params, encode, contentType);
		String result = clientBean.doPost();
		return result;
	}

	/**
	 * PUT请求
	 * 
	 * @param url
	 * @param params
	 * @param encode
	 * @param contentType
	 * @return
	 */
	public static String doPut(String url, Map<String, String> params, String encode, ContentTypeEnum contentType)
			throws Exception {
		HttpClientBean clientBean = new HttpClientBean(url, params, encode, contentType);
		String result = clientBean.doPut();
		return result;
	}

	/**
	 * DELETE请求
	 * 
	 * @param url
	 * @param params
	 * @param encode
	 * @param contentType
	 * @return
	 */
	public static String doDelete(String url, Map<String, String> params, String encode, ContentTypeEnum contentType)
			throws Exception {
		HttpClientBean clientBean = new HttpClientBean(url, params, encode, contentType);
		String result = clientBean.doDelete();
		return result;
	}
}
